local skel = fk.CreateSkill {
  name = "emo__nvpu",
}

Fk:loadTranslationTable{
  ["emo__nvpu"] = "女仆",
  [":emo__nvpu"] = "出牌阶段限一次，你可以获得一名其他角色的一张牌，并摸一张牌，若两张牌点数均大于/均小于【优雅】记录的点数，你可以令【优雅】点数+1/-1，然后令一名其他角色摸一张牌/弃置一张牌。",

  ["#emo__nvpu"] = "女仆：获得一名其他角色的一张牌，并摸一张牌",
  --["#emo__nvpu-choice"] = "女仆：你可以令【优雅】点数+1/-1，然后令一名其他角色摸一张牌/弃置一张牌",
  ["#emo__nvpu-ask"] = "女仆：你可以令【优雅】点数 %arg",
  ["#emo__nvpu-draw"] = "女仆：令一名其他角色摸一张牌",
  ["#emo__nvpu-discard"] = "女仆：令一名其他角色弃置一张牌",
}

skel:addEffect("active", {
  anim_type = "control",
  target_num = 1,
  card_num = 0,
  prompt = "#emo__nvpu",
  target_filter = function (self, player, to_select, selected)
    return #selected == 0 and to_select ~= player and not to_select:isNude()
  end,
  times = function (self, player)
    return 1 - player:usedSkillTimes(skel.name, Player.HistoryPhase)
  end,
  can_use = function (self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) == 0
  end,
  on_use = function (self, room, use)
    local player, to = use.from, use.tos[1]
    local mark = player:getMark("@emo__youya")
    local get = room:askToChooseCard(player, {
      target = to, flag = "he", skill_name = skel.name
    })
    room:obtainCard(player, get, false, fk.ReasonPrey, player, skel.name)
    if player.dead then return end
    local draw = player:drawCards(1, skel.name)[1]
    if player.dead or not draw or mark == 0 then return end
    local num1, num2 = Fk:getCardById(draw).number, Fk:getCardById(get).number
    local add = num1 > mark and num2 > mark
    local minus = num1 < mark and num2 < mark
    if not add and not minus then return end
    local fix = add and "+1" or "-1"
    if not room:askToSkillInvoke(player, {skill_name = skel.name, prompt = "#emo__nvpu-ask:::".. fix }) then return end
    room:setPlayerMark(player, "@emo__youya", mark + tonumber(fix) )
    local prompt = add and "#emo__nvpu-draw" or "#emo__nvpu-discard"
    local tos = room:askToChoosePlayers(player, {
      targets = room:getOtherPlayers(player, false), min_num = 1, max_num = 1, skill_name = skel.name,
      prompt = prompt, cancelable = false,
    })
    if #tos > 0 then
      local to2 = tos[1]
      if add then
        to2:drawCards(1, skel.name)
      else
        room:askToDiscard(to2, {
          min_num = 1, max_num = 1, skill_name = skel.name, include_equip = true, cancelable = false,
        })
      end
    end
  end,
})

return skel
